- /* sfffsdiv.cpp by K.Tsuru */
- // function ID = 715 DRADIX
- /***********************************
- SFraction class
- It devides "x" by a short value "n" i.e. multiplys by "1/n".
- x.num 1 x.num
- ------- * --- = ----------
- x.den n n*x.den
- ************************************/
- #ifndef SN_H
- #include "sn.h"
- #endif
-
- SFraction FsDiv(const SFraction& x, ulong n){
- if(n == 1uL) return x;
- if(n == 0) x.num.SetError(x.num.DIVIDED_BY_ZERO,"FsDiv", 715);
-
- SFraction r(x);
- if(n <= r.den.SlOpMaxValue()) r.den = LsMult(r.den, n);
- else r.den *= n;
- r.reduceDone = false;
- #if REDUCE_SIZE != 0
- r.reduce(false);
- #else
- r.reduce();
- #endif
- return r;
- }
sfffsdiv.cpp : last modifiled at 2017/10/23 11:09:52(688 bytes)
created at 2015/12/22 16:07:29
The creation time of this html file is 2017/10/23 11:26:54 (Mon Oct 23 11:26:54 2017).